package cn.good.yan.controller.t1;

import cn.good.yan.service.t1.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * 演示 - Redis
 *
 * @author shengren.yan
 * @create 2023-11-08
 */
@RestController
@Slf4j
@Api(tags = "订单接口")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @ApiOperation("新增订单")
    @GetMapping("/order/add")
    public String addOrder(){
        orderService.add();
        return "ok";
    }

    @ApiOperation("按照keyId 查询订单")
    @GetMapping("/order/{keyId}")
    public String getOrderId(@PathVariable Integer keyId){
        return orderService.getKey(keyId);
    }

}
